<?php
namespace app\common\validate;

use think\Validate;

class OrderValidate extends Validate
{
    protected $rule =   [
        'page|页数'            => 'require|integer',
        'limit|条数'           => 'require|integer',
        'id|订单ID'            => 'require|integer',
        'order_id|订单ID'      => 'require|integer',
        'user_id|用户ID'       => 'require|integer',
        'product_id|产品ID'    => 'require|integer',
        'sku_id|规格ID'        => 'require|integer',
        'address_id|地址ID'    => 'require|integer',
        'total|实付金额'       => 'require|gt:0',
        'status|订单状态'      => 'require|in:2,3,4',
    ];
    
    protected $scene = [
        /** api */
        'add'        => ['user_id', 'product_id', 'sku_id', 'address_id', 'total'],
        'show'       => ['order_id'],
        'pay'        => ['order_id', 'user_id'],
        'list_api'   => ['user_id', 'page', 'limit', 'status'],
        'send'       => ['user_id', 'order_id'],

        /** admin */
        'list'        => ['page', 'limit'],
        'show_admin'  => ['id'],
    ];
}